#include <iostream>
#include "Vertex.h"
using namespace std;

Vertex::Vertex(int ID) { 
        // give as follows as an example. nothing to do for this function
	inList.resize(0); 
	outList.resize(0);
	id = ID;
	pos = 0;
	//pos = new int(0);
}

void Vertex::enInList(Edge inedge){
	// push_back
	inList.push_back(inedge);
}

void Vertex::enOutList(Edge outedge) {
	// similar to above
	outList.push_back(outedge);
}
void Vertex::printInEdge(){ //This is rather confusing...
	// print in edges for test purpose
	cout << "\nVertex " << id << ": \nIncoming edges (weight excluded): ";
	if (inList.empty()){
		cout << "None.\n";
		return;
	}
	for (int i = 0; i < inList.size(); i++)
	{
		cout << '(' << inList[i].getsVertP()->getID() << "->"
			<< inList[i].geteVertP()->getID() << ") ";
	}
	cout << '\n';
}
void Vertex::printOutEdge(){
	// print out edges for test purpose
	cout << "Outgoing edges (weight excluded): ";
	if (outList.empty()){
		cout << "None.\n";
		return;
	}
	for (int i = 0; i < outList.size(); i++)
	{
		cout << '(' << outList[i].getsVertP()->getID() << "->"
			<< outList[i].geteVertP()->getID() << ") ";
	}
	cout << '\n';
}

int Vertex::getID(){
	// return the identity of the vertex
	return id;
}

void Vertex::set_id(int ID){
	id = ID;
}

vector<Edge>& Vertex::get_ol() { return outList; }
vector<Edge>& Vertex::get_il() { return inList; }
